package thread;

import  java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class Thread_BlockingQueue {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(100);
        queue.put("jcw");//带阻塞功能的入队列(offer不带)
        String temp = queue.take();//带阻塞功能的出队列(poll不带)
        System.out.println("temp: "+temp);
        temp = queue.take();
        System.out.println("temp: "+temp);//此处不会打印 队列中没有元素 (阻塞)
    }
}
